#ifndef RENDERER_HPP
#define RENDERER_HPP

#include "Game/Objects/Library.h"

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <vector>

class GameObject;
class Level;
class Player;
class SpriteManager;

#define M_PI 3.14159265358979323846

class Renderer
{
    private:
        int m_width;
        int m_height;
        Library m_library;

        sf::RenderWindow * App;

        sf::Image bgImage;
        sf::Sprite bgSprite;
        sf::PostFX ShaderEffect;
        sf::PostFX BgEffect;

        //TEXTS
        sf::String title;
        sf::String group;
        sf::String credits;
        sf::String ggj;
        //BUTTONS
        sf::String startButton;
        sf::String quitButton;
        sf::String creditsButton;
        sf::String backButton;
        //FONT
        sf::Font menuFont;

        static const unsigned int TRACE_COUNT = 30;
        std::vector<sf::Vector2<float> > m_trace;


        float blurStarCount;
        float blurStarMax,blurStarMin;
        float blurStar;
        bool blurStarGrow;

        void updateTrace(const float x, const float y);
        void drawTrace(const SpriteManager& manager);

    public:
        Renderer(sf::RenderWindow*);

        bool onText(sf::String*,int,int);
        int drawMenu(int,int,bool);
        int drawCredits(int,int,bool);
        void drawBg();
		void drawWarp(const SpriteManager& manager);
        void draw(std::vector<GameObject*> , SpriteManager *);
        void drawLevel(const Level&, const SpriteManager&);
        void drawPlayer(const Player&, const SpriteManager&);
        void drawDrawable(const sf::Drawable& item);
        int loadShader();
        void sendParameters();
        void trace(const Player& player, const SpriteManager& manager);
        void setInput(sf::Input&);

        void clear();
        void refresh();

        sf::RenderWindow * getApp();
};

#endif
